import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
	{
		path: '/films',
		component: () => import('../views/Films/index.vue'),
		children: [
			{
				path: 'nowPlaying',
				component: () =>
					import('../views/Films/Films_child/Films_nowPlaying.vue'),
			},
			{
				path: 'comingSoon',
				component: () =>
					import('../views/Films/Films_child/Films_comingSoon.vue'),
			},
			{
				path: '',
				redirect: '/films/nowPlaying',
			},
		],
	},
	{
		path: '/cinemas',
		component: () => import('../views/Cinemas/index.vue'),
	},
	{
		path: '/main',
		component: () => import('../views/Main/index.vue'),
	},
	{
		path: '/film/:id',
		component: () => import('../views/Detil/index.vue'),
	},
	{
		path: '/city',
		component: () => import('../views/City/index.vue'),
	},
	{
		path: '/login',
		component: () => import('../views/Login/Login.vue'),
	},
	{
		path: '/register',
		component: () => import('../views/Login/Register.vue'),
	},
	{
		path: '/cinemas/serch',
		component: () => import('../views/Cinemas/CinemasChild/CinemasSerch.vue'),
	},

	{
		path: '*',
		redirect: '/films',
	},
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes,
})

export default router
